<!--
 * @Author: CHINAKAIYUAN<sunkaiyuan@namenode.cn>
 * @Date: 2022-02-03 14:41:20
 * @LastEditTime: 2023-11-11 15:20:15
 * @LastEditors: 孙开源 && sunkaiyuan@namenode.cn
 * @Description:  自主报工明细
-->
<template>
	<sc-VxeTable
		ref="xGrid"
		:gridEvts="gridEvents"
		:gridOps="gridOps"
		:tablecode="'pro_process_productDetails'"
		:url="api.pro.proProDetail.list"
	>
	</sc-VxeTable>
	<SaveDialog
		v-if="dialog.save"
		ref="saveDialog"
		@success="handleSuccess"
		@closed="dialog.save = false"
	>
	</SaveDialog>
</template>
<script>
export default {
	name: "pro_process_productDetails",
};
</script>
<script setup>
import SaveDialog from "./savePro";
// import { useRouter } from "vue-router";
import { ref, nextTick } from "vue";
import api from "@/api";

const xGrid = ref({});
const dialog = ref({
	save: false,
});
const saveDialog = ref({});
const handleSuccess = () => {
	xGrid.value.refresh();
};
const gridOps = {
	columns: [
		{
			field: "barcode",
			className: "red",
		},
		// {
		// 	field: "process.name",
		// 	className: "red",
		// },
		// {
		// 	field: "material.name",
		// 	className: "blue",
		// },
	],
};
const gridEvents = {
	add: () => {
		dialog.value.save = true;
		nextTick(() => {
			saveDialog.value.open();
		});
	},
	edit: ({ button }) => {
		dialog.value.save = true;
		nextTick(() => {
			saveDialog.value.setData(button.selectRecords[0]).open();
		});
	},
};
</script>
